package com.ushine.design.design.a_creative_mode.a_simple_factory.b_example;

public class ChartFactory {
    public static Chart getChart(String type) {
        Chart chart = null;
        if (ChartConstant.HISTOGRAM_CHART.equalsIgnoreCase(type)) {
            chart = new HistogramChart();
            System.out.println("初始化设置柱状图。");
        } else if (ChartConstant.PIE_CHART.equalsIgnoreCase(type)) {
            chart = new PieChart();
            System.out.println("初始化设置饼状图。");
        } else if (ChartConstant.LINE_CHART.equalsIgnoreCase(type)) {
            chart = new LineChart();
            System.out.println("初始化设置折线图。");
        }
        return chart;
    }
}
